package com.otp.webapp.action;

import java.io.Serializable;
import java.util.List;

import org.appfuse.service.GenericManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.otp.model.test.template.Item;
//SHOULD PROBABALY DELETE THIS CLASS!!

@Scope("request")
@Component("itemList")
public class ItemList extends BasePage implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = -3253572554426323801L;
	private GenericManager<Item, Long> itemManager;
	
	@Autowired
	 public void setItemManager(@Qualifier("itemManager") GenericManager<Item, Long> itemsManager) {
        this.itemManager = itemsManager;
    }

    public ItemList() {
        setSortColumn("objectId"); // sets the default sort column
    }

    @SuppressWarnings("unchecked")
	public List<Item> getItems() {
        return sort(itemManager.getAll());
    }
}
